package com.lbssoft.datalink.sync;

import com.alibaba.fastjson.JSON;
import com.lbssoft.datalink.model.Result;
import com.lbssoft.datalink.entity.SyncDevice;
import com.lbssoft.datalink.util.Constant;
import com.lbssoft.datalink.util.HttpClientUtil;

public class DeviceService {
	String appsecret;
	 public DeviceService(String appsecret){
		 this.appsecret = appsecret;
	}

	public Result add(SyncDevice device) {
		return HttpClientUtil.sendHttpPostJson(Constant.SERVER_CONTEXT_URL+"/devices",appsecret, JSON.toJSONString(device));
	}

	public Result delete(String uuid) {
		// TODO Auto-generated method stub
		return HttpClientUtil.sendHttpDelete(Constant.SERVER_CONTEXT_URL+"/devices/"+uuid,appsecret);
	}

	public Result update(SyncDevice device) {
		// TODO Auto-generated method stub
		return HttpClientUtil.sendHttpPut(Constant.SERVER_CONTEXT_URL+"/devices/"+device.getUuid(),appsecret,JSON.toJSONString(device));
	}


}
